
package com.gifts.service.entity;
import com.gifts.service.entity.*;
/**
 * Entity class for GoogleShoppingObj
 * @author cagri
 *
 */
public class GoogleShoppingObj {
	private GoogleProduct [ ] data;
	private boolean hasItem;
	private boolean resetted=false;
	private int currentIndex;
	
	public GoogleShoppingObj(){
		data=new GoogleProduct[INITIAL_SIZE];
	}
	public GoogleShoppingObj(int size){
		data=new GoogleProduct[size];
	}
	public int getCurrent(){
		return currentIndex;
	}
	public void resetCurrent(){
		currentIndex=0;
	}
	public void reset(){
		resetted=true;
	}
	public boolean isReset(){
		return resetted;
	}
	public void add(GoogleProduct prod){
		data[currentIndex++]=prod;
	}
	public GoogleProduct getProduct(int index){
		return data[index];
	}
	public GoogleProduct[] getProducts(){
		return data;
	}
	public GoogleProduct getCurrentProduct(){
		return data[currentIndex];
	}
	public void advance(){
		currentIndex++;
	}
	public void setHasItems(boolean bool){
		hasItem=true;
	}
	public boolean hasItems(){
		return hasItem;
	}
	public String toString(){
		String result="";
		for (GoogleProduct pro:data){
			result+=pro.toString()+"\n";
		}
		return result;
	}
	public static final int INITIAL_SIZE=25;

}
